package com.jwdf.uda.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;

import com.jwdf.uda.R;
import com.jwdf.uda.ui.fragment.base.BaseFragment;
import com.jwdf.uda.ui.fragment.user.login.LocalAuthCodeFragment;
import com.jwdf.uda.ui.fragment.user.login.ResetPasswordFragment;

/**
 * Created by Administrator on 2016/5/31.
 */
public class ForgetPasswordActivity extends AbsTitleBarActivity {

    public static void start(Context context, String title,String mobile) {
        Intent intent = new Intent(context, ForgetPasswordActivity.class);
        intent.putExtra("title", title);
        intent.putExtra("mobile",mobile);
        context.startActivity(intent);
    }

    public static void start(Context context,String judge){
        Intent intent = new Intent(context, ForgetPasswordActivity.class);
        intent.putExtra("judge",judge);
        context.startActivity(intent);
    }

    @Override
    protected String getTopTitle() {
        String title = getString(R.string.forget_passwd);
        if (getIntent().hasExtra("title")) {
            title = getIntent().getStringExtra("title");
        }
        return title;
    }

    @Override
    protected Bundle onPutArguments() {
        Bundle args = new Bundle();
        args.putString("mobile", getIntent().getStringExtra("mobile"));
        args.putString("judge",getIntent().getStringExtra("judge"));
        return args;
    }

    @Override
    protected BaseFragment onCreateContentFragment() {
        if(TextUtils.isEmpty( onPutArguments().getString("judge"))){
            return new ResetPasswordFragment();
        }else {
            return new LocalAuthCodeFragment();
        }
    }

}
